<template>
  <div class="app-container-pc">
    <div class="foreword-item">
      <div class="line"></div>
      <div class="title">TOP SELLING GAMER MARKETPLACES</div>
    </div>

    <ul>
      <li
        v-for="(item, index) in menu_list"
        :key="index"
        @click="toPropsList(item)"
      >
        <p class="name ellipsis">{{ item.name }}</p>
      </li>
    </ul>
    <div class="line"></div>
  </div>
</template>

<script setup>
import { categories } from "@/api/product";
import { ref, reactive } from "vue";
import { useRoute, useRouter } from "vue-router";
import { useStore } from "vuex";

const route = useRoute();
const router = useRouter();
const store = useStore();

// 获取游戏分类列表
const menu_list = ref([]);
const getProductList = () => {
  categories({
    parent_ids: [
      100300, 100301, 100302, 100303, 100304, 100305, 100306, 100307, 100308,
      100309, 100310, 100311,
    ],
  }).then((res) => {
    menu_list.value = res.data;
    // console.log(menu_list.value);
  });
};
getProductList();

// 跳转道具分类列表
const toPropsList = (item) => {
  router.push({
    path: "/propsList",
    query: { id: item.id },
  });
};
</script>

<style lang="scss" scoped>
.app-container-pc {
  background: url("@/assets/home/bgsvg.png") no-repeat;
  margin-top: 40px;
  .line {
    width: 2px;
    height: 50px;
    background: #ffa300;
    margin: 0 auto;
    margin-bottom: 40px;
  }
  .foreword-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 10px;
    .title {
      font-size: 34px;
      font-weight: bold;
      color: #ffffff;
      margin-bottom: 8px;
    }
    p {
      font-size: 22px;
      color: #ffffff;
      margin-top: 8px;
    }
  }
  ul {
    margin: 34px 0 60px;
    display: grid;
    grid-template-columns: repeat(6, 2fr);
    gap: 20px;
    li {
      padding: 0 5px;
      height: 94px;
      position: relative;
      font-size: 14px;
      text-align: center;
      background: #5d37cd;
      border: 1px solid transparent;
      border-radius: 6px;
      cursor: pointer;
      color: #fff;
      .name {
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 16px;
        // font-weight: 700;
        z-index: 200;
      }
      &:hover {
        background: none;
        border: 1px solid #5d37cd;
        .name {
          color: #fff;
        }
      }
    }
  }
}
</style>
